<?
/******************************************************************************
 ** Shows the MsgBox
 *****************************************************************************/
class MyTerminal extends GtkWindow
{
    function MyTerminal($lines)
    {
        GtkWindow::__construct();
        GtkWindow::set_title('Debug');
        GtkWindow::set_default_size(480,360);
        GtkWindow::realize();
        GtkWindow::connect_simple('key_press_event', array(&$this, 'KeyTest'), $this);
        GtkWindow::set_position(GTK_WIN_POS_CENTER);
        $gdkwindow = $this->window;
        $ok = new Icone($gdkwindow, images . 'fileclose.xpm',
              ' '.Trans::Translate('Close').' ', Trans::Translate('Close'), true);
    
        $hbox = new GtkHBox;
        $hbox->pack_start(new GtkHBox, true, true);
        $hbox->pack_start($ok, false, false);
        $hbox->pack_start(new GtkHBox, true, true);
    
        $ok->connect_simple('clicked', array($this, 'Hide'), $ok);
        GtkWindow::connect_simple('destroy', array($this, 'Hide'), $this);
    
        $vbox = new GtkVBox;
        GtkWindow::add($vbox);
    
        $this->texto = $texto = new ScintillaEditor();
        $this->texto->TerminalMode();
        $this->texto->TerminalOpen($lines);
        $vbox->pack_start($texto, true, true);
        $vbox->pack_start($hbox, false, false);
        
        $fontcolor = new GdkColor('#000000');
        $texto->TerminalOpen($lines);
    
        GtkWindow::show_all();
    }
    
    function Load($lines)
    {
        $texto = $this->texto;
        $texto->TermnalOpen($lines);
        GtkWindow::show_all();
    
    }

    function Hide()
    {
        GtkWindow::hide();
    }

    function KeyTest($obj)
    {
        if (in_array($obj->keyval, array(K_ENTER, K_ESC, K_SPACE)))
            GtkWindow::hide();
    }
}

/*
class ScintillaTerminal extends GtkScintilla
{
	function ScintillaTerminal()
	{
		GtkScintilla::__construct();
		GtkScintilla::set_margin_type_n(2, 0);
		GtkScintilla::set_margin_width_n(2, 0);
		GtkScintilla::set_margin_width_n(1, 20);
		GtkScintilla::set_usize(400, 300);
		GtkScintilla::set_sel_back(true,    11250603);
		GtkScintilla::marker_set_back(true, 15908608);
        GtkScintilla::set_wrap_mode(1);
        GtkScintilla::set_view_eol(0);
		GtkScintilla::set_tab_width(4);
		GtkScintilla::set_use_tabs(0);
		GtkScintilla::set_indent(4);
		GtkScintilla::set_edge_mode(0);
		GtkScintilla::set_edge_column(80);
		GtkScintilla::set_edge_colour(8355712);
		GtkScintilla::set_style_bits(7);
		GtkScintilla::show_lines(0,GtkScintilla::get_line_count());
		GtkScintilla::show();

		if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
		{
			$font =    '-*-courier new-bold-*-*-*-*-140-*-*-*-*-*-*';
			$lilfont = '-*-courier new-bold-*-*-*-*-140-*-*-*-*-*-*';
			$etcfont = '-*-courier new-bold-*-*-*-*-140-*-*-*-*-*-*';
		}
		else
		{
			$font    = '-*-luxisans-bold-r-normal-*-18-*-*-*-*-*-*-*';
			$lilfont = '-*-luxisans-medium-r-normal-*-18-*-*-*-*-*-*';
			$etcfont = '-*-lucidatypewriter-medium-r-normal-*-18-*-*-*-*-*-*';
		}
		//$font2 = Gdk::font_load($etcfont);
		//GtkScintilla::set_margin_width_n(0, $font2->width(str_repeat('0',(4))));

        $pango = new PangoFontDescription('Courier bold 16');

		GtkScintilla::style_set_font(SCINTILLA_STYLE_DEFAULT, $pango);
		GtkScintilla::style_set_fore(SCINTILLA_STYLE_DEFAULT, 0);
		GtkScintilla::style_set_back(SCINTILLA_STYLE_DEFAULT, hexdec('#000000'));
	
		GtkScintilla::style_set_font(SCINTILLA_STYLE_LINE_NUMBER, $lilfont);
		GtkScintilla::style_set_fore(SCINTILLA_STYLE_LINE_NUMBER, 0);
		GtkScintilla::style_set_back(SCINTILLA_STYLE_LINE_NUMBER, 11053224);


		for  ($n=118; $n<=127; $n++) //PHP BACK
		{
			GtkScintilla::style_set_back($n, hexdec('#000000'));
            GtkScintilla::style_set_fore($n, hexdec('#FFFFFF'));
			GtkScintilla::style_set_font($n, $font);
		}
		for  ($n=0; $n<=29; $n++) //HTML BACK
		{
			GtkScintilla::style_set_back($n, hexdec('#000000'));
            GtkScintilla::style_set_fore($n, hexdec('#FFFFFF'));
			GtkScintilla::style_set_font($n, $font);
		}
		GtkScintilla::style_set_back(18, hexdec('#000000')); // HTML AND PHP TAGS

	}
    
	function Open($lines)
	{
		GtkScintilla::clear_all();
        foreach($lines as $line)
        {
            GtkScintilla::insert_text(-1, $line . "\n");
        }
		GtkScintilla::empty_undo_buffer();
        GtkScintilla::set_read_only(1);
	}
}
*/
?>